package mrdemo005;

import java.io.IOException;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

public class MaxMinMap  extends Mapper<LongWritable, Text, IntWritable, Text>{
	
	private Text val = new Text("");

	@Override
	protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, IntWritable, Text>.Context context)
			throws IOException, InterruptedException {
		
		String line = value.toString();
		
		//输入的数据行，长度大于0则输出
		if(line!=null && line.trim().length()>0) {
			//每一行就是一个数据，直接输出： <num ,"">
			//todo: 对每一行数据是否是一个整数进行判断
			context.write(new IntWritable(Integer.valueOf(line)), val);
 		}
	}
}
